package club.gskj.gulimall.order.controller;

import java.util.Arrays;
import java.util.Map;

import club.gskj.gulimall.order.entity.RefundInfoEntity;
import club.gskj.gulimall.order.service.RefundInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import club.gskj.common.utils.PageUtils;
import club.gskj.common.utils.R;


/**
 * 退款信息
 *
 * @author 康纳-connor
 * @email 2417039231@gmail.com
 * @date 2021-03-27 16:26:19
 */
@RestController
@RequestMapping("ware/refundinfo")
public class RefundInfoController {
    @Autowired
    private club.gskj.gulimall.order.service.RefundInfoService RefundInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = RefundInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id) {
        RefundInfoEntity RefundInfo = RefundInfoService.getById(id);

        return R.ok().put("RefundInfo", RefundInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody RefundInfoEntity RefundInfo) {
        RefundInfoService.save(RefundInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody RefundInfoEntity RefundInfo) {
        RefundInfoService.updateById(RefundInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        RefundInfoService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
